<?php
/**
 * View parcial para campo form admin
 * @param campo
 * @param cabecalho
 * @param valor
 * @param required
 * @param hint
 */
$campo = $this->campo;
$cabecalho = $this->cabecalho;
$valor = $this->valor;
$hint = $this->hint;
?>
<script type="text/javascript">
<!--
$(function() {
	$('.remover').live('click', function() {
		//var remover = $(this).add($(this).prev('br')).add($(this).prev('br').prev('br')).add($(this).prev('br').prev('br').prev('input'));
		$(this).parent('div').remove();
	});
	
	$('#adicionar').click(function() {
		$("input[name='<?php echo $campo;?>']:last").after($('#novoInput').html());
		//$("input[name='<?php echo $campo;?>']:last").after($('<input/>').addClass('text-input large-input {validate: {required: <?php echo (isset($this->required) && $this->required == false) ? 'false' : 'true'; ?>}}').attr('name', '<?php echo $campo;?>')).after($('<input/>').attr({'type':'button', 'value':'remover'}).addClass('button remover')).after('<br /><br />');
	});
});
//-->
</script>
<label style="float: left;" for="<?php echo $campo; ?>"><?php echo $cabecalho; ?></label><input style="float: left;" type="button" class="button" name="adicionar" id="adicionar" value="+" />
<input class="text-input large-input {validate: {required: <?php echo (isset($this->required) && $this->required == false) ? 'false' : 'true'; ?>}}" type="text" id="<?php echo $campo; ?>" name="<?php echo $campo; ?>" value="<?php echo $valor; ?>" />
<?php echo $hint; ?>
<div id="novoInput" style="display: none;">
	<input class="text-input large-input {validate: {required: <?php echo (isset($this->required) && $this->required == false) ? 'false' : 'true'; ?>}}" type="text" name="<?php echo $campo;?>" />
	<input type="button" value="remover" class="button remover" />
	<br /><br />
</div>